﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using OnlineCourse.Model.Entity;
using System;
using System.Collections.Generic;
using System.Text;

namespace OnlineCourse.Model.EntityConfiguration
{
    public class CouponsRecordConfiguration : IEntityTypeConfiguration<CouponsRecord>
    {
        public void Configure(EntityTypeBuilder<CouponsRecord> builder)
        {
            builder.Property(a => a.Id).HasDefaultValueSql("newid()");
            builder.Property(a => a.Source).HasMaxLength(150).IsRequired();//指定字段长度，并且指定他不能为null
        }
    }

}
